<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="Visualizar Evento"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            
            <div style="float: left; width: 50%;" >
            
            <h:form>
                <h:panelGrid columns="2">

                    <h:outputText value="Título: "/>
                    <h:outputText value="#{eventoController.selected.titulo}" title="Título"/>
                    <h:outputText value="Editor: "/>
                    <h:outputText value="#{eventoController.selected.editor}" title="Editor"/>
                    <h:outputText value="Tipo: "/>
                    <h:outputText value="#{eventoController.selected.tipo}" title="Tipo"/>
                    <h:outputText value="Descrição: "/>
                    <h:outputText value="#{eventoController.selected.descricao}" title="Descrição"/>
                    <h:outputText value="Data de Fim de Submissão: "/>
                    <h:outputText value="#{eventoController.selected.dataFimSubmissoes}" title="Data de Fim de Submissões">
                        <f:convertDateTime pattern="dd/MM/yyyy" />
                    </h:outputText>
                    <h:outputText value="Data de Fim de Revisões: "/>
                    <h:outputText value="#{eventoController.selected.dataFimRevisoes}" title="Data de Fim de Revisões">
                        <f:convertDateTime pattern="dd/MM/yyyy" />
                    </h:outputText>
                    <h:outputText value="Data de Realização: "/>
                    <h:outputText value="#{eventoController.selected.dataRealizacao}" title="Data de Realização">
                        <f:convertDateTime pattern="dd/MM/yyyy" />
                    </h:outputText>
                    
                </h:panelGrid>
                <br />
                <h:commandLink action="Edit" value="Editar" rendered="#{eventoController.isDono(eventoController.selected.editor)}"/>
                <br />
                <h:commandLink action="#{eventoController.prepareList}" value="Lista de Eventos"/>
                <br />
                <br />
                <h:commandLink action="#{submissaoController.criarSubmissao(eventoController.selected.idEvento)}" rendered="#{eventoController.podeCriarSubmissao(eventoController.selected)}" value="Criar Submissao"/>


            </h:form>
                
            </div>
            
            <div style="float: right; width: 50%" >
                <h:form styleClass="jsfcrud_list_form">
                <h:panelGroup rendered="#{eventoController.submissoes.rowCount > 0}">
                <h:dataTable value="#{eventoController.submissoes}" var="submissao" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Título"/>
                            </f:facet>
                            <h:outputText value="#{submissao.titulo}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Sumário"/>
                            </f:facet>
                            <h:outputText value="#{submissao.sumario}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Tipo"/>
                            </f:facet>
                            <h:outputText value="#{submissao.tipo}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Autor"/>
                            </f:facet>
                            <h:outputText value="#{submissao.autor}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{submissaoController.prepareSubmissaoView(eventoController.submissoes)}" value="Ver"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{submissaoController.prepareSubmissaoEdit(eventoController.submissoes)}" rendered="#{eventoController.editarSubmissao(submissao)}" value="Editar"/>
                            <h:outputText value="  "/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Revisões"/>
                            </f:facet>
                            <h:commandLink action="#{revisorController.prepareRevisores(eventoController.submissoes)}" rendered="#{eventoController.podeRevisoes(eventoController.selected)}" value="Revisores" />
                            <h:outputText value=" "/>
                            <h:commandLink action="#{revisaoController.prepareRevisoesList(eventoController.submissoes)}" value="Revisões" />
                        </h:column>
                </h:dataTable>
                </h:panelGroup>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>

</html>
